import { Module } from '@nestjs/common';
import { DbController } from './db.controller';
import { TypeOrmModuleOptions, TypeOrmModule } from '@nestjs/typeorm';
import AppEntity from './entity/app.entity';
import PersonEntity from './entity/person.entity';
import FileEntity from './entity/file.entity';
import { ClientsModule, Transport } from '@nestjs/microservices';
import RoleEntity from './entity/role.entity';
import RoleMenuEntity from './entity/menu.entity';

const mysqlConnect: TypeOrmModuleOptions = {
  type: 'mariadb',
  host: 'localhost',
  port: 3306,
  username: 'root',
  password: '4230338z',
  database: 'app_publish',
  entities: [AppEntity, FileEntity, PersonEntity, RoleEntity, RoleMenuEntity],
  synchronize: true,
  charset: 'utf8',
};
const TypeORMConfig = TypeOrmModule.forRoot(mysqlConnect);

@Module({
  imports: [TypeORMConfig],
  controllers: [DbController],
  exports: [],
})
export class DbModule {}
